'use strict';
import React, {
    Component
} from 'react'
import {
    Link,
    hashHistory
} from 'react-router'
import {
    HttpService,
    Tips,
    imgUpload,
    AjaxUploadImg,
    viewerImg,
    GetDateStr,
    browser,
    getClassList,
    dateFormat,
    showLoading,
    showHiding,
    taskFinish
} from '../Tools'



import Header from './Common/Header'
import Footer from './Common/Footer'
import ConfirmBox from './Common/ConfirmBox'
import DatePicker from 'react-mobile-datepicker'

import addImg2 from '../Img/icon/add_img2.png'
import imgradio from '../Img/icon/hw_voice3.png'
import imgVideo from '../Img/icon/add_video.png'
import imgVideo2 from '../Img/icon/add_video2.png'
import imgradiobo from '../Img/icon/hw_bo.png'
import imgradiozan from '../Img/icon/hw_zan.png'
//import audioTest from '../audio/test.mp3'

export default class TaskPublish extends Component {
    constructor(props) {
        super(props);
        this.imgfile = '';
        this.publish = false;
        this.imgradio = null
        this.state = {
            vioce: false,
            contentNumber: 0,
            isHaveImg: false,
            isHaveRadio: false,
            isHaveVideo: false,
            subjictList: [],
            classList: [],
            selectClassList: [],
            studentIds: [],
            footerList: false,
            isOpen: false
        }
        //APP调用的音频方法
        window.appRecord = (funcName, status, msg) => {
            if (!funcName) {
                Tips('无此方法');
                return
            }
            if (funcName == 'stopVoice' || funcName == 'onVoicePlayEnd') { //停止语音（手动、监听）
                if (status == 0) {
                    if (this.imgradio.getAttribute('status') == 1)
                        return
                    this.imgradio.setAttribute('src', imgradiobo)
                    this.imgradio.setAttribute('status', 2)
                }
            } else if (funcName == 'uploadVoice') { //上传语音
                this.publish = false;
                if (status == 0) {
                    sessionStorage.musicFileStr = msg
                    this.TaskPublish();
                } else {
                    Tips('上传语音失败')
                    showHiding()
                }
            }
            console.log(`funcName:${funcName}, status:${status}`);
        }
        /*
        //APP调用的视频方法
        funcName:方法名称（selectVideo：选择视频/uploadVideo：上传视频）
        status：状态（true/false）
        msg:消息说明（文件大小30MB ）
         */
        window.appVideo = (funcName, status, msg) => {
            if (!funcName) {
                Tips('无此方法');
                return
            }
            if (funcName == 'selectVideo') {
                this.setState({
                    isHaveVideo: status == 0 ? true : false
                })
            } else if (funcName == 'uploadVideo') { //上传视频
                this.publish = false;
                if (status == 0) {
                    sessionStorage.movieFileStr = msg
                    this.TaskPublish();
                } else {
                    Tips('上传视频失败')
                    showHiding()
                }
            }
        }
    }

    componentWillMount() {
        delete sessionStorage.musicFileStr
        delete sessionStorage.movieFileStr

        //查询科目列表
        HttpService.query({
            url: '/jxt-commonbackground/ajaxHomework.do',
            data: {
                jybTicket: sessionStorage.ticket,
                method: 'm101LoadCourseNameByTeacher'
            },
            //async: false,
            success: (res => {
                if (res.code == 0) {
                    this.setState({
                        subjictList: res.rs
                    });
                    return;
                }
                $('.maskin').show()
                Tips('当前帐号非任课教师<br/>该功能无法使用');
            })
        });
        getClassList((classList) => {
            if (classList.length > 0) {
                this.setState({
                    classList: classList
                });
                //查询班级学生
                HttpService.query({
                    url: '/jxt-commonbackground/ajaxLoaderCommonUserInfo.do',
                    data: {
                        jybTicket: sessionStorage.ticket,
                        orgid: classList[0].id,
                        userrole: '学生',
                        method: 'ajaxJybJSON_LoadUserInfoByOrgIdAndUserRole'
                    },
                    //async: false,
                    success: (res => {
                        if (res.code == 0) {
                            this.setState({
                                studentList: res.rs
                            });
                            return;
                        }
                        Tips(res.msg);
                    })
                });
            }
        });
    }

    componentDidMount() {
        document.querySelector('#time').innerHTML = dateFormat(new Date(), '-', false);
        setTimeout(() => {
            if (document.getElementById('imgradio')) {
                this.imgradio = document.getElementById('imgradio')
                this.imgradio.setAttribute('status', 1)
            }
        }, 600)
    }

    cfmCancel() {
        if (sessionStorage.app == 'true') {
            if (sessionStorage.appback == 2) {
                hashHistory.goBack(-1);
                return
            }
            hashHistory.push('/Task');
        } else {
            hashHistory.goBack(-1);
        }
    }
    //发送数据
    postData(data) {
        HttpService.query({
            url: '/jxt-commonbackground/ajaxHomework.do',
            data,
            success: (res => {
                showHiding()
                setTimeout(() => {
                    this.publish = false;
                }, 400)
                if (res.code == 0) {
                    Tips('发布成功');
                    taskFinish('发布作业', (status, config) => {
                        if (status) {
                            this.config = config;
                            this.setState({
                                show: 1
                            })
                        } else {
                            this.cfmCancel()
                        }
                    })
                } else {
                    Tips(res.msg);
                }
            })
        })
    }

    //发布作业
    TaskPublish() {
        if (this.publish)
            return
        let requireDate = document.querySelector('#time').innerText; //时间
        let subjectSelect = document.querySelector('.subjectSelect').value; //选择的科目
        let homewrkContent = document.querySelector('#homewrkContent').value; //作业内容
        let rct = this;
        if (requireDate == '' || requireDate == '选择时间') {
            Tips('请选择时间！');
            return;
        }
        if (subjectSelect == '') {
            Tips('请选择科目！');
            return;
        }
        if (this.state.selectClassList == '') {
            Tips('请选择班级！');
            return;
        }
        if (homewrkContent == '' && this.state.isHaveImg == false) {
            Tips('请填写作业内容！');
            return;
        }
        let data = {
            jybTicket: sessionStorage.ticket,
            method: 'm201AddHomework',
            wherefrom: 'android',
            classIds: rct.state.selectClassList,
            studentIds: '',
            requireDate: requireDate,
            content: homewrkContent,
            requireSign: this.refs.requireSign.value,
            type: '作业',
            title: subjectSelect + '作业', //sendDate + '_' +
            courseName: subjectSelect,
            smsSelf: '否',
            sendSms: '否'
        };
        this.publish = true;
        showLoading()
        Tips('正在发布...', 0);

        //上传语音接口,且停止语音播放
        if (this.state.isHaveRadio) {
            if (!sessionStorage.musicFileStr) {
                if (sessionStorage.wherefrom == 'ios') {
                    window.webkit.messageHandlers.pauseVoice.postMessage('end');
                    window.webkit.messageHandlers.uploadVoice.postMessage('end');
                } else if (sessionStorage.wherefrom == 'android') {
                    appweb.stopVoice()
                    appweb.uploadVoice()
                } else {
                    let rct = this;
                    wx.uploadVoice({
                        localId: sessionStorage.localId, // 需要上传的音频的本地ID，由stopRecord接口获得
                        isShowProgressTips: 1, // 默认为1，显示进度提示
                        success: function(res) {
                            sessionStorage.serverId = res.serverId; // 返回音频的服务器端ID
                            $.ajax({
                                url: 'http://api.17find.com/teacherapp/teacher/saveHomeworkVoice',
                                type: 'POST',
                                dataType: 'json',
                                data: `token=${sessionStorage.appToken}&voiceId=${res.serverId}`,
                                success: function(res) {
                                    rct.publish = false;
                                    if (res.code == 50006) {
                                        let data = JSON.parse(res.data);
                                        if (data.code == 0) {
                                            sessionStorage.musicFileStr = data.msg
                                            rct.TaskPublish();
                                            return
                                        }
                                    }
                                    Tips(res.msg)
                                    showHiding()
                                },
                                error: function() {
                                    rct.publish = false;
                                    Tips('上传语音失败')
                                    showHiding()
                                }
                            })
                        }
                    });
                }
                return
            }
            data.musicFileStr = sessionStorage.musicFileStr
        }

        if (this.state.isHaveVideo) { //上传视频
            if (!sessionStorage.movieFileStr) {
                if (sessionStorage.wherefrom == 'ios') {
                    window.webkit.messageHandlers.appVideo.postMessage('uploadVideo');
                } else if (sessionStorage.wherefrom == 'android') {
                    setTimeout(function() {
                        appweb.appVideo('uploadVideo')
                    }, 100)
                } else {
                    var files = document.getElementById('txtvideo').files;
                    AjaxUploadImg(files[0], function(res) {
                        rct.publish = false;
                        if (res.status == 'ok') {
                            sessionStorage.movieFileStr = res.msg
                            rct.TaskPublish();
                        } else {
                            Tips('上传视频失败');
                            showHiding()
                        }
                    }.bind(this))
                }
                return;
            }
            data.movieFileStr = sessionStorage.movieFileStr
        }

        if (this.state.isHaveImg) { //上传图片
            AjaxUploadImg(this.imgfile, function(res) {
                if (res.status == 'ok') {
                    data.picFileStr = res.msg
                    rct.postData(data);
                } else {
                    Tips('上传图片失败');
                    showHiding()
                    rct.publish = false;
                    Tips(res.msg);
                }
            })
        } else {
            this.postData(data);
        }
    }
    //录音开始
    addVioce(e) {
        e.preventDefault()
        sessionStorage.addVioceTime = new Date().getTime().toString().slice(-6)
        clearTimeout(sessionStorage.vioceOut)
        sessionStorage.vioceOut = setTimeout(() => { //录音最长一分钟
            if (this.state.vioce) {
                Tips('录音最长一分钟')
                this.stopVioce()
                this.setState({
                    vioce: false
                })
            }
        }, 1000 * 60)
        document.getElementById('voice_img').className = 'voice_img selected'
        document.querySelector('.voice_button').className = 'voice_button active'
        if (sessionStorage.wherefrom == 'ios') {
            window.webkit.messageHandlers.startRecord.postMessage(1);
        } else if (sessionStorage.wherefrom == 'android') {
            appweb.startRecord()
        } else {
            wx.startRecord({
                cancel: function() {
                    Tips('用户拒绝授权录音', 1);
                }
            });
        }
    }
    //录音结束
    stopVioce() {
        let isHaveRadio = false
        let timedif = Number(new Date().getTime().toString().slice(-6)) - Number(sessionStorage.addVioceTime)
        if (timedif / 1000 > 1) { //超过一秒 合格
            this.imgradio.setAttribute('src', imgradiobo)
            this.imgradio.setAttribute('status', 2)
            this.setState({
                vioce: false,
                isHaveRadio: true
            })
            if (sessionStorage.wherefrom == 'ios') {
                window.webkit.messageHandlers.stopRecord.postMessage('end');
            } else if (sessionStorage.wherefrom == 'android') {
                appweb.stopRecord()
            } else {
                wx.stopRecord({
                    success: function(res) {
                        sessionStorage.localId = res.localId;
                    }
                });
            }
        } else {
            document.getElementById('voice_img').className = 'voice_img'
            if (sessionStorage.wherefrom == 'ios') {
                window.webkit.messageHandlers.stopRecord.postMessage('end');
            } else if (sessionStorage.wherefrom == 'android') {
                appweb.stopRecord()
            } else {
                // wx.stopRecord({
                //     success: function(res) {
                //         sessionStorage.localId = res.localId;
                //     }
                // });
            }
            Tips('时间太短，重新录音', 1)
            document.querySelector('.voice_button').className = 'voice_button'
        }
        // if (this.state.voice)
        //     document.querySelector('.voice_button').className = 'voice_button'
        delete sessionStorage.stopRecord
    }

    //语音显示、播放、暂停
    viewerRadio() {
        const status = this.imgradio.getAttribute('status')
        let rct = this
        if (status == 1) { //添加
            this.setState({
                vioce: true
            })
        } else if (status == 2) { //播放
            this.imgradio.setAttribute('src', imgradiozan)
            this.imgradio.setAttribute('status', 3)
            if (sessionStorage.wherefrom == 'ios') {
                window.webkit.messageHandlers.playVoice.postMessage('end');
            } else if (sessionStorage.wherefrom == 'android') {
                appweb.playVoice()
            } else {
                //播放语音接口
                wx.playVoice({
                    localId: sessionStorage.localId // 需要播放的音频的本地ID，由stopRecord接口获得
                });
                //监听语音播放完毕接口
                wx.onVoicePlayEnd({
                    success: function(res) {
                        //Tips('播放完毕')
                        rct.imgradio.setAttribute('src', imgradiobo)
                        rct.imgradio.setAttribute('status', 2)
                    }
                });
            }
        } else { //暂停
            this.imgradio.setAttribute('src', imgradiobo)
            this.imgradio.setAttribute('status', 2)
            if (sessionStorage.wherefrom == 'ios') {
                window.webkit.messageHandlers.pauseVoice.postMessage('end');
            } else if (sessionStorage.wherefrom == 'android') {
                appweb.pauseVoice()
            } else {
                //暂停播放接口
                wx.pauseVoice({
                    localId: sessionStorage.localId // 需要暂停的音频的本地ID，由stopRecord接口获得
                });
            }
        }
    }



    //语音显示/隐藏
    setVioce() {
        console.log('setVioce');
        this.setState({
            vioce: !this.state.vioce
        })
    }

    /**
     * 清空img
     */
    closeIMg(isradio, e) {
        e.preventDefault();
        delete sessionStorage.musicFileStr
        delete sessionStorage.movieFileStr
        if (isradio == 1) { //语音删除
            this.imgradio.setAttribute('src', imgradio)
            this.imgradio.setAttribute('status', 1)
            this.setState({
                isHaveRadio: false
            })
            if (sessionStorage.wherefrom == 'ios') {
                //window.webkit.messageHandlers.stopVoice.postMessage('end');
                window.webkit.messageHandlers.pauseVoice.postMessage('end');
            } else if (sessionStorage.wherefrom == 'android') {
                appweb.stopVoice()
            } else {
                //停止语音播放
                wx.stopVoice({
                    localId: sessionStorage.localId
                });
            }
            return
        }
        if (isradio == 2) { //视频删除
            this.setState({
                isHaveVideo: false
            })
            return
        }
        document.querySelector('#upimg').setAttribute('src', addImg2);
        document.querySelector('#taskimgadd').style.backgroundImage = 'url(' + addImg2 + ')';
        document.querySelector('.upViewerImg').setAttribute('src', addImg2);
        this.setState({
            isHaveImg: false
        });
    }

    //图片上传的表单
    upLoadImg(inputId, imgId) {
        let rct = this;
        rct.setState({
            stop: 1
        });
        imgUpload({
            inputId,
            imgId,
            imgIeId: imgId,
            presWidth: 1000
        }, function(status, msg) {
            rct.setState({
                stop: 0,
                isHaveImg: true
            });
            if (status) {
                Tips('图片添加成功', 1);
                rct.imgfile = msg;
                document.querySelector('.upViewerImg').src = document.getElementById('upimg').src
                document.querySelector('#taskimgadd').style.backgroundImage = 'url(' + document.getElementById('upimg').src + ')';
            } else {
                Tips(msg);
                rct.imgfile = '';
                document.getElementById('upimg').src = addImg2;
                document.querySelector('#taskimgadd').style.backgroundImage = 'url(' + addImg2 + ')';
            }
        });
    }
    /**
     * 计算剩余输入字数
     * @returns {XML}
     */
    changeContentNumber(e) {
        this.setState({
            contentNumber: e.target.value.length
        });
    }

    /**
     * 获取班级
     */
    getSubjectList() {
        let selectClassList = this.state.selectClassList;
        let class_checkboxs = document.querySelectorAll('.class_checkbox');
        for (let j = 0; j < class_checkboxs.length; j++) {
            class_checkboxs[j].checked = false;
        }
        if (selectClassList.length > 0) {
            let lists = document.querySelector('.content_list').children;
            for (let j = 0; j < selectClassList.split(',').length; j++) {
                for (let i = 0; i < lists.length; i++) {
                    let listsChild = lists[i].childNodes[0].childNodes;
                    let selectId = listsChild[0].defaultValue;
                    if (selectId == selectClassList.split(',')[j]) {
                        listsChild[0].checked = true;
                        break;
                    }
                }
            }
        }
        this.setState({
            footerList: true
        });
    }

    /**
     * 选择班级列表-取消
     * @returns {XML}
     */
    cancelSubject() {
        this.setState({
            footerList: false
        });
    }

    /**
     *  选择班级列表-确定
     * @returns {XML}
     */
    addSubject() {
        if (this.state.classList == '') {
            this.setState({
                selectClassList: []
            });
            this.cancelSubject();
        } else {
            this.state.selectClassList = [];
            this.setState({
                studentIds: []
            }); //设置学生列表为空
            let selectValues = '',
                selectIds = '';
            let lists = document.querySelector('.content_list').children;
            for (let i = 0; i < lists.length; i++) {
                let listsChild = lists[i].children[0].childNodes;
                let isSelect = listsChild[0].checked;
                if (isSelect) {
                    let selectId = listsChild[0].defaultValue;
                    let selectValue = listsChild[1].innerText;
                    selectIds += ',' + selectId;
                    selectValues += ',' + selectValue;
                }
            }
            if (selectValues.length > 0) {
                selectValues = selectValues.substr(1, selectValues.length);
                selectIds = selectIds.substr(1, selectIds.length);
            }
            document.querySelector('#classes').value = selectValues;
            this.setState({
                selectClassList: selectIds
            });
            this.cancelSubject();
        }
    }

    /**
     * 查询班级的学生
     * @returns {XML}
     */
    getStudents(orgid) {
        HttpService.query({
            url: '/jxt-commonbackground/ajaxLoaderCommonUserInfo.do',
            data: {
                jybTicket: sessionStorage.ticket,
                orgid: orgid,
                userrole: '学生',
                method: 'ajaxJybJSON_LoadUserInfoByOrgIdAndUserRole'
            },
            //async: false,
            success: (res => {
                if (res.code == 0) {
                    for (let i = 0; i < res.rs.length; i++) {
                        this.state.studentIds.push(res.rs[i].id);
                    }
                    this.setState({
                        studentIds: this.state.studentIds
                    });
                    return;
                }
                Tips(res.msg);
            })
        })
    }

    /**
     * 选择班级
     */
    onChangeClassName(e) {
        console.log(e.currentTarget.checked);
        if (e.currentTarget.checked) {
            HttpService.query({
                url: '/jxt-commonbackground/ajaxLoaderCommonUserInfo.do',
                data: {
                    jybTicket: sessionStorage.ticket,
                    orgid: e.target.value,
                    userrole: '学生',
                    method: 'ajaxJybJSON_LoadUserInfoByOrgIdAndUserRole'
                },
                async: false,
                success: (res => {
                    if (res.code == 0) {
                        if (res.rs.length == 0) {
                            Tips('该班级没有学生,不能选择！', 1);
                            e.preventDefault();
                        }
                        return;
                    }
                    Tips(res.msg);
                })
            })
        }
    }
    /**
     * 调用时间插件
     */
    handleClick(e) {
        this.setState({
            isOpen: true
        });
    }
    handleCancel() {
        this.setState({
            isOpen: false
        });
    }

    handleSelect(time) {
        document.querySelector('#time').innerHTML = new Date(time).toLocaleString().split(' ')[0].replace(/\//g, '-').replace('年', '-').replace('月', '-').replace('日', '');
        // document.querySelector('#time').innerHTML = dateFormat(new Date(time), '-', false);
        this.setState({
            time,
            isOpen: false
        });
    }

    //选择视频APP
    sltVideoApp(e) {
        if (sessionStorage.app == 'true') {
            e.preventDefault();
            if (window.webkit) {
                window.webkit.messageHandlers.appVideo.postMessage('selectVideo');
            } else if (window.appweb) {
                appweb.appVideo('selectVideo')
            }
        }
    }

    //选择视频
    sltVideo() {
        var files = document.getElementById('txtvideo').files;
        if (files && files[0]) {
            if (files[0].size > 1024 * 1024 * 50) {
                Tips('视频大小超过50MB')
                return
            }
            this.setState({
                isHaveVideo: true
            })
            this.createIMG();
            $('#videosrc').attr('src', 'file:///C:/Users/admin/Downloads/2.mp4')
        } else {
            this.setState({
                isHaveVideo: false
            })
        }
    }
    createIMG() {
        return
        var scale = 0.25,
            video = document.getElementById('txtvideo').files[0],
            canvas = document.createElement("canvas"),
            canvasFill = canvas.getContext('2d'),
            img = new Image();
        img.src = video;
        canvas.width = img.videoWidth * scale;
        canvas.height = img.videoHeight * scale;
        canvasFill.drawImage(img, 0, 0, canvas.width, canvas.height);

        var src = canvas.toDataURL("image/jpeg");
        $('#imgvideo').attr('arc', src);
    }

    render() {
        const publishLink = <a className='h_link color_blue' onClick={this.TaskPublish.bind(this)}>发布</a>;
        const {
            vioce,
            contentNumber,
            isHaveImg,
            isHaveRadio,
            isHaveVideo,
            classList,
            subjictList,
            footerList
        } = this.state;
        const classTagList = classList.map((item) => {
            return (
                <li className='cbx'>
                    <label><input type="checkbox" className="class_checkbox" value={item.id} onClick={this.onChangeClassName.bind(this)}/>
                        <span>{item.name}</span>
                    </label>
                </li>
            )
        });
        const subjictTagList = subjictList.map((item) => {
            return (
                <option value={item.courseName} dir="ltr">{item.courseName}</option>
            )
        });
        return (
            <div className='homework'>
                <Header title='布置作业' link={publishLink} appLink='1' appsign={this.props.params.app}/>
                <div className="lt_hw_list lt_delivery_time" onClick={this.handleClick.bind(this)}>
                    <span className="title">完成时间</span>
                    <div className="hw_right">
                        <span className="data_time" id="time">选择时间</span>
                    </div>
                    <span className="input_right_img"/>
                </div>
                <label className="lt_hw_list lt_subject">
                    <span className="title">科目</span>
                    <div className="hw_right">
                        <select name="" className="subjectSelect" dir="rtl">
                            {subjictTagList}
                        </select>
                    </div>
                    <span className="input_right_img"/>
                </label>
                <label className="lt_hw_list lt_subject">
                    <span className="title" style={{width: '10.67rem'}}>是否需要签收</span>
                    <div className="hw_right" style={{width: '-webkit-calc(100% - 12.33rem)'}}>
                        <select className="subjectSelect" dir="rtl" ref='requireSign'>
                            <option value='0'>否</option>
                            <option value='1'>是</option>
                        </select>
                    </div>
                    <span className="input_right_img"/>
                </label>
                <div className="lt_hw_list lt_class_name">
                    <span className="title">班级</span>
                    <span className="img" onClick={this.getSubjectList.bind(this)}/>
                    <div className="hw_right_bottom class_tare">
                        <textarea name="" cols="30" rows="2" id="classes" readOnly='readOnly' placeholder="请添加班级(可多选)"/>
                    </div>
                </div>
                <div className="lt_hw_list lt_hw_content">
                    <span className="title">作业内容</span>
                    <div className="hw_right_bottom homewrk_tare">
                        <textarea name="" cols="30" maxLength='1000' id="homewrkContent" onChange={this.changeContentNumber.bind(this)} placeholder="请填写具体作业内容(最多1000字)"/>
                    </div>
                </div>
                <div className="img_word clearfix">
                    <div className="hw_img_voice">
                        <div className="homewrk_tare_img">
                            <label>
                                <div className='taskimgadd' id='taskimgadd' style={{backgroundImage:"url("+addImg2+")"}}>
                                {isHaveImg == false
                                    ? ''
                                    : <span className="close" onClick={this.closeIMg.bind(this,0)}/>
                                }
                                <img src={addImg2} id='upimg' style={{
                                    display: isHaveImg == false
                                        ? 'block'
                                        : 'none'
                                }}/>
                                <img src={addImg2} className='upViewerImg' style={{
                                    display: isHaveImg == true
                                        ? 'block'
                                        : 'none'
                                }} onClick={viewerImg.bind(this, 'src')}/> {isHaveImg == false
                                    ? <input className='upcard hidden' name='front' type="file" id="upcard" accept="image/gif,image/jpeg,image/jpg,image/png" onChange={this.upLoadImg.bind(this, 'upcard', 'upimg')}/>
                                    : ''
                            }</div>
                            </label>
                            {
                            <label>
                                {isHaveRadio == false
                                    ? ''
                                    : <span className="close" onClick={this.closeIMg.bind(this,1)}/>
                            }
                            <img id='imgradio' src={imgradio} className='radioimg' onClick={this.viewerRadio.bind(this)}/>
                            </label>}
                            {sessionStorage.weixin=='true'|| (sessionStorage.app=='true' &&sessionStorage.video=='true')?
                            <label onClick={this.sltVideoApp.bind(this)}>
                                <input type='file' accept='video/*' id='txtvideo' className='hidden' onChange={this.sltVideo.bind(this)} />
                                {isHaveVideo == false
                                    ? ''
                                    : <span className="close" onClick={this.closeIMg.bind(this,2)}/>}
                                    <img id='imgvideo' src={isHaveVideo?imgVideo2:imgVideo} className='radioimg'/>
                            </label>:null}

                        </div>
                    </div>
                    <div className="remaining_word_count">({contentNumber}/1000)</div>
                </div>
                <div className="lt_hw_list lt_prompt clearfix" style={{marginBottom:'20px'}}>
                    <span className="title">温馨提示：</span>
                    <div className="hw_right"  style={{height:'auto'}}>图片限制10MB，语音限制1分钟,视频限制50MB</div>
                </div>
                {vioce == true
                    ? <div className="voice_model">
                            <div className="model_layout" onClick={this.setVioce.bind(this)}></div>
                            <div className="content">
                                <span className="voice_img" id='voice_img' />
                                <input type='button' className="voice_button" value='按住说话'
                                     onTouchStart={this.addVioce.bind(this)}
                                     onTouchEnd={this.stopVioce.bind(this)}
                                      />
                            </div>
                        </div>
                    : ''}

                <div className="footer_List" style={{
                    display: footerList == true
                        ? 'inline-block'
                        : 'none'
                }}>
                    <div className='maskin' onClick={this.cancelSubject.bind(this)}/>
                    <Footer>
                        <div className="content">
                            <div className="button clearfix">
                                <span className="cancel" onClick={this.cancelSubject.bind(this)}>取消</span>
                                <span className="ok" onClick={this.addSubject.bind(this)}>确定</span>
                            </div>
                            <ul className="content_list " id='pjb_cbxlist'>
                                {classTagList == ''
                                    ? <p>没有数据</p>
                                    : classTagList}
                            </ul>
                        </div>
                    </Footer>
                </div>
                <DatePicker theme={browser().ios == true
                    ? 'ios'
                    : 'android'} showFormat="YYYY-MM-DD" min={new Date(GetDateStr(0))} value={this.state.time} isOpen={this.state.isOpen} onSelect={this.handleSelect.bind(this)} onCancel={this.handleCancel.bind(this)}/>
                    <ConfirmBox config={this.config} show={this.state.show} cancel={this.cfmCancel.bind(this)}/>
            </div>
        )
    }
}
